#include "junix.h"

int main(int argc, char **argv)
{
	int fds[2];
	if(pipe(fds)==-1)
		err_sys("pipe");

	struct stat st;
	if(-1== fstat(fds[0], &st))
		err_sys("fstat");

	if( S_ISFIFO(fds[0]) )
		fputs("fifo\n",stdout);

	fprintf(stdout,"ino:%ld\n",st.st_ino);
	fprintf(stdout,"uid:%d\n",st.st_uid);
	fprintf(stdout,"gid:%d\n",st.st_gid);
	fprintf(stdout,"size:%ld\n",st.st_size);
	fprintf(stdout,"mode:%d\n",st.st_mode);

	mode_t md=st.st_mode;
	if( md & S_IRUSR )
	   printf("S_IRUSR\n");	
	if( md & S_IWUSR )
	   printf("S_IWUSR\n");	
	if( md & S_IXUSR )
	   printf("S_IXSR\n");	

	return 0;
}

